//
//  KLKeyTypeSelectTableViewController.m
//  KISSLOCK
//
//  Created by 陈宾鹏 on 16/8/10.
//  Copyright © 2016年 陈宾鹏. All rights reserved.
//

#import "KLKeyTypeSelectTableViewController.h"
#import "KLHelp.h"
#import "KLHttpAPI.h"
#import "HemaConst.h"
#import "HemaFunction.h"
#import "Masonry.h"
#import "JRToast.h"
#import "KLSendKeyTableViewController.h"
#import "KLReceiveKeyTableViewController.h"
#import "KLSendBrunchTableViewController.h"
#import "KLReceiveBrunchTableViewController.h"

@interface KLKeyTypeSelectTableViewController ()
@end

@implementation KLKeyTypeSelectTableViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;
    self.title = @"我的钥匙";
    self.tableView.tableFooterView = [[UIView alloc]init];
    [KLHelp navSet:self doBackHandeler:^(UIButton *backButton) {
        [backButton addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside];
    }];
}-(void)doBack:(id)sender{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"keyType"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    if(indexPath.row == 0){
        cell.textLabel.text = @"锁主钥匙及其下发的子钥匙";
    }else if(indexPath.row == 1){
        cell.textLabel.text = @"收到的子钥匙";
    }else if(indexPath.row == 2){
        cell.textLabel.text = @"发出的钥匙串";
    }else if(indexPath.row == 3){
        cell.textLabel.text = @"收到的钥匙串";
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if(indexPath.row == 0){
        KLSendKeyTableViewController *sendKeyVC = [[KLSendKeyTableViewController alloc]init];
        [self.navigationController pushViewController:sendKeyVC animated:YES];
    }else if (indexPath.row == 1){
        KLReceiveKeyTableViewController *receiveKeyVC = [[KLReceiveKeyTableViewController alloc]init];
        [self.navigationController pushViewController:receiveKeyVC animated:YES];
    }else if (indexPath.row == 2){
        KLSendBrunchTableViewController *sendBrunchVC = [[KLSendBrunchTableViewController alloc]init];
        [self.navigationController pushViewController:sendBrunchVC animated:YES];
    }else if (indexPath.row == 3){
        KLReceiveBrunchTableViewController *receiceBrunchVC = [[KLReceiveBrunchTableViewController alloc]init];
        [self.navigationController pushViewController:receiceBrunchVC animated:YES];
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
@end
